import request from "@/config/axios";

// AI 图片 API
export const ImageApi = {
  // 获取【我的】绘图分页
  getImagePageMy: async (params) => {
    return await request.get({ url: `/ai/image/my-page`, params });
  },
  // 获取【我的】绘图记录
  getImageMy: async (id) => {
    return await request.get({ url: `/ai/image/get-my?id=${id}` });
  },
  // 获取【我的】绘图记录列表
  getImageListMyByIds: async (ids) => {
    return await request.get({ url: `/ai/image/my-list-by-ids`, params: { ids: ids.join(",") } });
  },
  // 生成图片
  drawImage: async (data) => {
    // return await request.post({ url: `/ai/image/draw`, data })
    return await request.post({ url: `/ai/image/keling/imagine`, data });
  },
  // 删除【我的】绘画记录
  deleteImageMy: async (id) => {
    return await request.delete({ url: `/ai/image/delete-my?id=${id}` });
  },

  // ================ midjourney 专属 ================

  // 【Midjourney】生成图片
  midjourneyImagine: async (data) => {
    return await request.post({ url: `/ai/image/midjourney/imagine`, data });
  },
  // 【Midjourney】Action 操作（二次生成图片）
  midjourneyAction: async (data) => {
    return await request.post({ url: `/ai/image/midjourney/action`, data });
  },

  // ================ 绘图管理 ================

  // 查询绘画分页
  getImagePage: async (params) => {
    return await request.get({ url: `/ai/image/page`, params });
  },

  // 更新绘画发布状态
  updateImage: async (data) => {
    return await request.put({ url: "/ai/image/update", data });
  },

  // 删除绘画
  deleteImage: async (id) => {
    return await request.delete({ url: `/ai/image/delete?id=` + id });
  },

  // 模型列表
  getImageModelList: async (params) => {
    return await request.get({ url: `/ai/image-model/getImageModelList`, params });
  },
};
